<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .myboder{
        border: 1px blueviolet solid
    }
    .myfont{
        font-size: 60px;
    }
</style>
<body>
    <div id="div1" style="color: aqua;" class="myborder" title="div1">这是一个div</div>
    <img src="./img/mowan.png" width="100px" height="100px">
    <input type="text" id="username">
    <script>
        let div1 = document.getElementById("div1")
        div1.title = "xxxx"
        div1.style.color="blue"
        div1.style.backgroundColor="green"
        console.log(div1.title)
        div1.setAttribute("title","yyyy")
        let title=div1.getAttribute("title")

        let img=document.getElementsByTagName("img")[0]
        img.setAttribute("src","./img/lingzhu.png")

        div1.style.color="blue"
        img.style.border="10px red solid"
        img.style.borderRadius="60px"

        div1.classList.add('myfont')
        let flag=img.classList.contains("myfont")
        console.log(flag)



        // div1.onclick =()=>{
        //     console.log("111222333")
            
        //     div1.classList.toggle("myfont")
        // }
        
        div1.addEventListener("click",function(){
            console.log("111222333")
            div1.classList.toggle("myfont")
        })

        img.addEventListener("mouseenter",function(){
            console.log("鼠标进入了图片区域")
        })
        img.addEventListener("mouseleave",function(){
            console.log("鼠标移出了图片区域")
        })
        img.addEventListener("mousemove",function(){
            console.log("鼠标在图片区域移动")
        })

        let username=document.getElementById("username")
        username.addEventListener("keyup",(event)=>{
            console.log("键盘被按下并抬起的键是",event.key)
        }

    </script>
    
</body>
</html>